//
//  SCNGoldTreeHintView.swift
//  ShoucainuSwift
//
//  Created by 王家旭 on 2017/5/25.
//  Copyright © 2017年 Riluee. All rights reserved.
//

import UIKit

class SCNGoldTreeHintView: UIView {
    
    public var hintText: String? {
        didSet {
            hintLabel.text = hintText
        }
    }

    lazy var angleImgView: UIImageView = {
        let imgView = UIImageView()
        imgView.image = UIImage(named: "angle")
        return imgView
    }()
    
    lazy var hintLabel: UILabel = {
        let lab = UILabel()
        lab.backgroundColor = .white
        lab.textColor = SCNConstants.colorWith255RGBA(36, g: 156, b: 78, a: 1)
        lab.font = UIFont.systemFont(ofSize: 12.0)
        lab.textAlignment = .center
        lab.layer.cornerRadius = 5.0
        lab.layer.masksToBounds = true
        return lab

    }()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        addSubview(angleImgView)
        addSubview(hintLabel)
        
        hintLabel.snp.makeConstraints { (make) in
            make.leading.trailing.equalTo(self)
            make.top.equalTo(self)
            make.bottom.equalTo(self).offset(-10)
        }
        
        angleImgView.snp.makeConstraints { (make) in
            make.top.equalTo(hintLabel.snp.bottom).offset(-1)
            make.centerX.equalTo(hintLabel)
            make.size.equalTo(CGSize(width: 7,height: 7))
        }
        
    }
    
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
